package com.speechb.modules.system.admin.controller;

import com.speechb.common.JwtUtil;
import com.speechb.modules.system.admin.controller.base.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * @author : llj
 * @version :2.1.0
 * @date : 2019/10/3 17:17
 */
@RequestMapping("${adminRoot}")
@Controller
public class AdminController extends BaseController {
    @GetMapping("")
    public String index() {
        return "admin/index";
    }
    @GetMapping("/dashboard")
    public String dashboard() {
        return "admin/dashboard";
    }
    @GetMapping("/speech_craft_list")
    public String speechCraftList() {
        return "admin/speech_craft/speech_craft_list";
    }

    @GetMapping("/speechcraft_title2")
    public String speechCraftTitle2() {
        return "admin/speech_craft/speechcraft_title2";
    }
    @GetMapping("/speechcraft_title1")
    public String speechCraftTitle1() {
        return "admin/speech_craft/speechcraft_title1";
    }

    @GetMapping("/image_battle")
    public String imageBattleList() {
        return "admin/image_battle/image_battle";
    }
    @GetMapping("/speech_craft/title2_publish")
    public String  speechCraftTitle1Publish() {
        return "admin/speech_craft/title2_publish";
    }
    @GetMapping("/speech_craft/title1_publish")
    public String  speechCraftTitle2Publish() {
        return "admin/speech_craft/title1_publish";
    }
    @GetMapping("/search_keyword")
    public String  searchKeywordList() {
        return "admin/speech_craft/search_keyword_list";
    }

    @GetMapping("/user")
    public String  userList() {
        return "admin/user/user_list";
    }
    @GetMapping("/system/config")
    public String  configList() {
        return "admin/system/config_list";
    }
    @GetMapping("/system/add_config")
    public String  addConfig() {
        return "admin/system/add_config";
    }
    @GetMapping("/hold_girl_book_list")
    public String  holdGirlBookList() {
        return "admin/hold_girl_book/hold_girl_book_list";
    }
    @GetMapping("/hold_girl_book_publish")
    public String  holdGirlBookPublish() {
        return "admin/hold_girl_book/hold_girl_book_publish";
    }
    @GetMapping("/article-list")
    public String articleList() {
        return "admin/article/article_list";
    }

    @GetMapping("/user_vip")
    public String  userVipList() {
        return "admin/user/user_vip_list";
    }
    @GetMapping("/add_activation_code")
    public String  addActivationCode() {
        return "admin/user/add_activation_code";
    }
    @GetMapping("/add_vip")
    public String  addVip() {
        return "admin/user/add_vip";
    }
    @GetMapping("/vip_activation_code_list")
    public String vipActivationCodeList() {
        return "admin/user/vip_activation_code_list";
    }
    @GetMapping("/change_password")
    public String changePassword() {
        return "admin/user/change_password";
    }
    @GetMapping("/change_user_info")
    public String changeUserInfo() {
        return "admin/user/change_user_info";
    }
    @GetMapping("/orders")
    public String orders() {
        return "admin/user/orders_list";
    }
    @GetMapping("/login_history")
    public String loginHistory() {
        return "admin/user/login_history_list";
    }
    @GetMapping("/sys_menu/menu_list")
    public String sysMenu() {
        return "admin/system/menu_list";
    }
    @GetMapping("/sys_user")
    public String sysUser() {
        return "admin/system/sys_user";
    }
    @GetMapping("/system_menu_publish")
    public String systemMenuPublish() {
        return "admin/system/system_menu_publish";
    }
    @GetMapping("/expression_templates_list")
    public String expressionTemplatesList() {
        return "admin/love_letter/expression_templates_list";
    }
    @GetMapping("/expression_templates_field_list")
    public String expressionTemplatesFieldList() {
        return "admin/love_letter/expression_templates_field_list";
    }
    @GetMapping("/expression_templates_user_list")
    public String expressionTemplatesUserList() {
        return "admin/love_letter/expression_templates_user_list";
    }
    @GetMapping("/expression_templates_user_word_list")
    public String expressionTemplatesUserWordList() {
        return "admin/love_letter/expression_templates_user_word_list";
    }
    @GetMapping("/expression_templates_list_publish")
    public String expressionTemplatesListPublish() {
        return "admin/love_letter/expression_templates_list_publish";
    }
    @GetMapping("/expression_templates_field_publish")
    public String expressionTemplatesFieldPublish() {
        return "admin/love_letter/expression_templates_field_publish";
    }

    /**
     * 获取访问资源签证
     */
    @GetMapping("/resource_sign")
    @ResponseBody
    public void resouceSign() {
        try {
            //过期时间10天
            String jwt = JwtUtil.createJWT("jwt", "root_jwt", 432000000);
            Map<String, String> map = new HashMap<String, String>(2);
            map.put("sign", "root_jwt");
            map.put("jwt", jwt);
            setData(map);
            renderUnCompressSuccess();
        } catch (Exception e) {
            e.printStackTrace();
            renderFail();
        }
    }
}
